/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.download.lib;
import java.util.concurrent.*;
import java.util.*;
/**
 *
 * @author 尹俊博
 */
public class SqrtTransform extends RecursiveAction {
    final int seqThreshold =10000;
    double [] data;
    int start,end;
    SqrtTransform (double[] vals,int s,int e) {
        data =vals;
        start =s;
        end = e;
        
    }
    @Override
    protected void compute() {
        if ((end - start)< seqThreshold) {
            for (int i = start;i<end;i++) {
                data[i] =Math.sqrt(data[i]);
            }
        }
        else {
            int middle =(start + end) / 2;
            invokeAll (new SqrtTransform(data,start,middle),
                    new SqrtTransform(data,middle,end));
        }
    }
    /**
     * @param args the command line arguments
     */
    
    
}
